<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>

  <body>
    <form>
      <input
        type="text"
        name="username"
        placeholder="请输入用户名"
        value="zhiyin"
      /><br />
      <input type="text" name="password" placeholder="请输入密码" /><br />
      <button type="submit">登录</button>
    </form>
  </body>
  <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
  <script>
    const form = document.querySelector('form')
    form.addEventListener('submit', function (e) {
      e.preventDefault()
      const formData = new FormData(form)
      formData.append('username', 'zhiyin')
      formData.append('password', '123456')
      console.log(formData.get('username'))
      console.log(formData.get('password'))
    })
  </script>
</html>
